feat: drag and drop elements on android - #122
Merged
IvanIhnatsiuk merged 2 commits intoJul 15, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Android drag-and-drop support for moving selected text within EnrichedTextInputView, by introducing a dedicated drag handler and wiring it into the view’s touch/drag lifecycle. This extends the Android editor interaction model while keeping insertion/deletion logic in existing clipboard/transaction utilities.
Changes:
- Introduces
EnrichedDragHandlerto start selection drags (long-press), handle drops, and remove the source text after local drops. - Integrates drag handling into
EnrichedTextInputView(onDragEvent,performLongClick, andonTouchEvent). - Updates the
Int.dphelper to return pixelInts (used for drag shadow sizing/padding).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/example/ios/Podfile.lock | Bumps ReactNativeEnriched pod version/checksum to match the new release. |
| android/src/main/java/com/swmansion/enriched/utils/Numbers.kt | Changes Int.dp to return Int pixels for UI sizing helpers. |
| android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt | Wires drag handler into view lifecycle and uses editableText for safer text operations. |
| android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt | New drag-and-drop implementation for moving selected text and managing drag shadow UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces drag-and-drop support for text selection in the
EnrichedTextInputView, enabling users to drag selected text within the input field. The main changes involve implementing a new handler for drag operations, integrating it into the view, and refining utility code for pixel density calculations.Drag-and-drop support for text selection:
EnrichedDragHandlerclass that manages drag-and-drop operations, including starting drags on long-press, handling drops, and deleting the source text after a local drag-and-drop. (android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt)EnrichedDragHandlerintoEnrichedTextInputViewby delegatingonDragEvent,performLongClick, andonTouchEventto the handler, ensuring seamless drag-and-drop interactions. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)Utility improvements:
dpextension property forIntto return anIntvalue based on the system's display metrics, improving pixel density calculations for UI elements like drag shadows. (android/src/main/java/com/swmansion/enriched/utils/Numbers.kt)Minor code quality improvements:
texttoSpannableStringBuilderwith the safereditableTextproperty inEnrichedTextInputView. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)DragEventto support drag-and-drop handling. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)Test Plan
Screenshots / Videos
Screen.Recording.2026-07-14.at.15.55.56.mov
Compatibility